﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ASoft.WPF.ViewModel;

namespace ASoft.WPF.View
{
    /// <summary>
    /// HistoryRoomChartControl.xaml 的交互逻辑
    /// </summary>
    public partial class HistoryRoomChartControl : UserControl
    {
        public HistoryRoomChartControl()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(HistoryRoomChartControl_Loaded);
            this.Unloaded -= new RoutedEventHandler(HistoryRoomChartControl_Loaded);
        }

        void HistoryRoomChartControl_Loaded(object sender, RoutedEventArgs e)
        {
            ((RoomInfoViewModel)this.DataContext).Series数据集合.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Series数据集合_CollectionChanged);
        }

        void Series数据集合_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            crlChart.SetValue(ChartHelper.SeriesSourceProperty, null);
            crlChart.SetValue(ChartHelper.SeriesSourceProperty, ((RoomInfoViewModel)this.DataContext).Series数据集合);
        }
    }
}
